﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utility1;

namespace eDream.admin
{
    public partial class xemgopy : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int month = DateTime.Now.Month;
                int year = DateTime.Now.Year;
                DateTime lastday = Utils.GetLastDayOfMonth(year, month);
                DateTime dtfrom = Utils.GetfirstDayOfMonth(year, month);
                dteFrom.Date = dtfrom;
                dteTo.Date = lastday;
            }
        }

        protected void ASPxCallbackPanel1_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            Bindata();
        }

        void Bindata()
        {
            DataClasses1DataContext dx = new DataClasses1DataContext();

            var list = from k in dx.Feeback_tbs
                       where k.datePost >= dteFrom.Date && k.datePost <= dteTo.Date
                       select k;
            grvResult.DataSource = list;
            grvResult.DataBind();
        }

        protected void grvResult_Load(object sender, EventArgs e)
        {
            Bindata();
        }
    }
}